#pragma once
#include <DSParaSet.h>
#include <DSMsgShower.h>
#include <vector>
#include <string>

//========== Type Define for Roles =========
typedef unsigned int DSRoleLv;
typedef unsigned int DSRoleHP;
typedef unsigned int DSRoleMP;
typedef DSui64		 DSRoleExp;
typedef unsigned int DSRoleAtk;
typedef unsigned int DSRoleDef;
typedef unsigned int DSRoleAgi;
typedef unsigned int DSRoleDex;
typedef unsigned int DSRoleVil;
typedef unsigned int DSRoleLuk;

#define BASE_LV		1
#define BASE_HP		300
#define BASE_MP		150
#define BASE_EXP	0
#define BASE_ATTK	30
#define BASE_DEF	50

#define BASE_LUK	20

#define LV1_UP_EXP	100	

class CDSRoleSetBased
{
//=============== Define ===================
	public:
		static const int ROLE_NAME_BUF_SIZE = 512;
		static const int ROLE_EXP_CURVE_BUF_SIZE = 996;
		static const int ROLE_ICON_FILE_PATH_SIZE = 512;
		typedef struct
		{
			//CString cstrName;
			//CString cstrExpCurve;
			char szName[ROLE_NAME_BUF_SIZE];
			char szExpCurve[ROLE_EXP_CURVE_BUF_SIZE];
			char szIconFilePath[ROLE_ICON_FILE_PATH_SIZE];

			DSRoleLv dsrLv;
			DSRoleHP dsrCurHP;
			DSRoleHP dsrMaxHP;
			DSRoleMP dsrCurMP;
			DSRoleMP dsrMaxMP;
			DSRoleExp dsrCurExp;
			DSRoleExp dsrLvUpExp;
			DSRoleAtk dsrAttk;
			DSRoleDef dsrDef;
			DSRoleLuk dsrLuk;
		}CDSRoleAttribs;

//=============== Data Member ==============
	protected:
		CDSRoleAttribs m_cdsRoleAttributs;

//=============Member Functions ============
	public:
		CDSRoleSetBased(void);
		~CDSRoleSetBased(void);
	
	protected:
		void InitAttribute(void);


//=========== Properties ================
	//Get
	public:
		inline const char* GetRoleName(void) {
			//return m_cdsRoleAttributs.cstrName; 
			return m_cdsRoleAttributs.szName;
		};

		inline const char* GetExpCurve(void) {
			//return m_cdsRoleAttributs.cstrExpCurve; 
			return m_cdsRoleAttributs.szExpCurve;
		};

		inline DSRoleLv GetRoleLv(void) {
			return m_cdsRoleAttributs.dsrLv; };

		inline DSRoleHP GetCurRoleHP(void) {
			return m_cdsRoleAttributs.dsrCurHP; };

		inline DSRoleHP GetMaxRoleHP(void) {
			return m_cdsRoleAttributs.dsrMaxHP; };

		inline DSRoleMP GetCurRoleMP(void) {
			return m_cdsRoleAttributs.dsrCurMP; };

		inline DSRoleMP GetMaxRoleMP(void) {
			return m_cdsRoleAttributs.dsrMaxMP; };

		inline DSRoleExp GetCurRoleExp(void) {
			return m_cdsRoleAttributs.dsrCurExp; };

		inline DSRoleExp GetNextLvExp(void) {
			return m_cdsRoleAttributs.dsrLvUpExp; };

		inline DSRoleAtk GetRoleAttack(void) {
			return m_cdsRoleAttributs.dsrAttk; };

		inline DSRoleDef GetRoleDefence(void) {
			return m_cdsRoleAttributs.dsrDef; };

		inline DSRoleLuk GetRoleLuck(void) { return m_cdsRoleAttributs.dsrLuk; };

		inline CDSRoleAttribs GetRoleAttribs(void) { return m_cdsRoleAttributs; };

		inline const char* GetIconFilePath(void) { return m_cdsRoleAttributs.szIconFilePath; };

	//Set
	public:
		inline void SetRoleName(const char* szName) {
			//m_cdsRoleAttributs.cstrName.Format("%s", szName); 
			try
			{
				strcpy(m_cdsRoleAttributs.szName, szName);
			}
			catch(std::bad_alloc ex)
			{
				CDSMsgShower::ShowMsgByErrorBox(NULL, "ACCERT", MB_OK, "Fail to set name of role(%s). The buffer size of name is %d, and the length of inputted name is %d.",
																	   szName, sizeof(m_cdsRoleAttributs.szName), sizeof(szName));
			}
		};

		inline void SetExpCurve(const char *szExpFunc) {
			//m_cdsRoleAttributs.cstrExpCurve = cstrExpFunc; 
			try
			{
				strcpy(m_cdsRoleAttributs.szExpCurve, szExpFunc);
			}
			catch(std::bad_alloc ex)
			{
				CDSMsgShower::ShowMsgByErrorBox(NULL, "ACCERT", MB_OK, "Fail to set exp. curve of role(%s). The buffer size of exp. curve is %d, and the length of inputted exp. curve is %d.",
																	   szExpFunc, sizeof(m_cdsRoleAttributs.szExpCurve), sizeof(szExpFunc));
			}
		};

		inline void SetIconFilePath(const char *szFilePath)
		{
			try
			{
				strcpy(m_cdsRoleAttributs.szIconFilePath, szFilePath);
			}
			catch(std::bad_alloc ex)
			{
				CDSMsgShower::ShowMsgByErrorBox(NULL, "ACCERT", MB_OK, "Fail to set file path of icon of role(%s). The buffer size of icon file path is %d, and the length of inputted icon file path is %d.",
																	   szFilePath, sizeof(m_cdsRoleAttributs.szIconFilePath), sizeof(szFilePath));
			}
		};

		inline void SetRoleLv(DSRoleLv unLv) {
			m_cdsRoleAttributs.dsrLv = unLv; };

		inline void SetCurRoleHP(DSRoleHP unHP) {
			m_cdsRoleAttributs.dsrCurHP = unHP; };

		inline void SetMaxRoleHP(DSRoleHP unHP) {
			m_cdsRoleAttributs.dsrMaxHP = unHP; };

		inline void SetCurRoleMP(DSRoleMP unMP) {
			m_cdsRoleAttributs.dsrCurMP = unMP; };

		inline void SetMaxRoleMP(DSRoleMP unMP) {
			m_cdsRoleAttributs.dsrMaxMP = unMP; };

		inline void SetCurRoleExp(DSRoleExp un64Exp) {
			m_cdsRoleAttributs.dsrCurExp = un64Exp; };

		inline void SetNextLvExp(DSRoleExp un64Exp) {
			m_cdsRoleAttributs.dsrLvUpExp = un64Exp; };

		inline void SetRoleAttack(DSRoleAtk unATK) {
			m_cdsRoleAttributs.dsrAttk = unATK; };

		inline void SetRoleDefence(DSRoleDef unDEF) {
			m_cdsRoleAttributs.dsrDef = unDEF; };

		inline void SetRoleLuck(DSRoleLuk unLUK) { m_cdsRoleAttributs.dsrLuk = unLUK; };

		inline void SetRoleAttribs(CDSRoleAttribs cdsRoleAttribs) { m_cdsRoleAttributs = cdsRoleAttribs; };
};
